package com.softa.common.utils;

import com.softa.common.constant.Constants;

import java.util.Random;

/**
 * description goes here.
 *
 * @author 杨磊
 * @date 2019/5/2 16:03
 * @since 1.0
 **/
public class CommonUtil {

    /**
     * 获得len位随机数字
     * @param len 随机数的长度
     * @return 随机数
     */
    public static String getRandomNumber(int len){
        Random r=new Random();
        StringBuilder sb=new StringBuilder();
        int charLen= Constants.ALLNUMBER.length();
        for (int i = 0; i < len; i++) {
            sb.append(Constants.ALLNUMBER.charAt(r.nextInt(charLen)));
        }
        return sb.toString();
    }

}
